const redis = require('redis');

// const client = redis.createClient(config.port, config.url); // 实例redis对象
// const client = redis.createClient({
//     url: 'http://42.192.51.46:6379',
//     port: ''
// }); 
const client = redis.createClient({
    url: 'redis://:GTgtgtGT912@142.192.51.46:6379'
});

//连接错误处理
client.on("error", err => {
    console.log('redis connect err', err);
});


const setString = (key, value, expire = 60) => {
    client.set(key, value, expire)
}

const getString = (key) => {
    client.get(key)
}

module.exports = {
    setString,
    getString
}


